import { FSMState } from "../Game/State/FSMState"

export default class FSMMgr {
  // 状态列表
  StateList: FSMState[] = []
  // 当前状态ID
  CurrentIndex: number = -1

  ChangeState(id: number) {
    if (this.CurrentIndex === id) return
    this.CurrentIndex = id
    this.StateList[this.CurrentIndex].OnEnter()
  }

  OnUpdate() {
    if (this.CurrentIndex != -1) {
      this.StateList[this.CurrentIndex].OnUpdate()
    }
  }
}